import '@/App.css';
import {Routes,Route} from "react-router-dom";
import Login from "@/pages/Login";
import { HistoryRouter, history } from './utils/'
import AuthComponents from './components/AuthComponents'
import GeekLayout from "@/pages/GeekLayout";
import Home from "@/pages/Home";
import Article from "@/pages/Article";
import Publish from "@/pages/Publish";

function App() {
  return (
    <HistoryRouter history={history}>
      <div className="App">
        <Routes>
          {/*AuthComponents 判断是否已经登录 如果未登录则跳转到login页面*/}
          {/*一级路由 主页*/}
          <Route path="/" element={<AuthComponents><GeekLayout/></AuthComponents>}>
            {/*二级路由 home*/}
            {/*<Route  path="/home" element={<Home/>}></Route>*/}
            {/*默认为主页 index*/}
            <Route index element={<Home/>}></Route>
            {/*二级路由 article*/}
            <Route path="/article" element={<Article/>}></Route>
            {/*二级路由 publish*/}
            <Route path="/publish" element={<Publish/>}></Route>
          </Route>
          {/*一级路由 登录*/}
          <Route path="/login" element={<Login/>}></Route>
        </Routes>
      </div>
    </HistoryRouter>
  );
}

export default App;
